package com.DeliveryProgram.www.po;

import com.DeliveryProgram.www.dao.BusLoad;

import java.util.ArrayList;
import java.util.List;

/**商家类*/
public class Business {

    private int bid;

    public Business(int bid, String shopname, String indroduce) {
        this.bid = bid;
        this.shopname = shopname;
        this.indroduce = indroduce;
    }

    private String name=null;
    private String shopname;
    private String indroduce;
    /**菜单*/
    private List<Menu>menu=new ArrayList<Menu>();
    /**该店的折扣*/
    private List<Coupons>coupons=new ArrayList<Coupons>();
    /**该店的订单*/
    private List<Order>orders=new ArrayList<Order>();
    /**当前收益*/
    private double earn;
    /**当前店铺的评论*/
    private List<Comment>comments=new ArrayList<Comment>();


    public Business(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setBid(int bid) {
        this.bid = bid;
    }

    public void setShopname(String shopname) {
        this.shopname = shopname;
    }

    public void setIndroduce(String indroduce) {
        this.indroduce = indroduce;
    }

    public int getBid() {
        return bid;
    }

    public String getShopname() {
        return shopname;
    }

    public String getIndroduce() {
        return indroduce;
    }

    public List<Menu> getMenu() {
        return menu;
    }

    public void setMenu(List<Menu> menu) {
        this.menu = menu;
    }
    public void setMenu(Menu menu){
        this.menu.add(menu);
    }

    public List<Coupons> getCoupons() {
        return coupons;
    }

    public void setCoupons(List<Coupons> coupons) {
        this.coupons = coupons;
    }
    public void setCoupons(Coupons coupons) {
        this.coupons.add(coupons);
    }

    public double getEarn() {
        return earn;
    }

    public void setEarn(double earn) {
        this.earn = earn;
    }

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrders(List<Order> orders) {
        this.orders = orders;
    }

    public void setOrders(Order orders) {
        this.orders.add(orders);
    }

    public List<Comment> getComments() {
        return comments;
    }

    public void setComments(List<Comment> comments) {
        this.comments = comments;
    }

    public void setComments(Comment comments) {
        this.comments.add(comments);
    }

    /**订单完成后增加商家收入*/
    public void addEarn(int money){
        earn+=money;
    }

    /**用户访问时获取所有相关数据*/
    public static void getMessage(Business bu){
        BusLoad.loadMenu(bu);
        BusLoad.loadCoupons(bu);
        BusLoad.loadBuComment(bu);
        BusLoad.loadUsComment(bu);
    }
}
